K8S部署calico网络插件有一个calico

您所在的位置:网站首页 autodetection of host K8S部署calico网络插件有一个calico

K8S部署calico网络插件有一个calico

2023-12-28 14:08| 来源: 网络整理| 查看: 265

1、情况是这样的,我在master部署calico网络插件的时候,运行完kubectl apply -f calico.yml后,查看pod运行情况:

(base) [root@master opt]# kubectl get pod -A NAMESPACE NAME READY STATUS RESTARTS AGE default nfs-client-provisioner-566f7f554d-6hww6 1/1 Running 0 21h kube-system calico-kube-controllers-7567d8d9dd-w8x4z 1/1 Running 3 4h1m kube-system calico-node-6h5d7 0/1 Running 0 23s kube-system calico-node-x8w6v 1/1 Running 0 7m50s kube-system coredns-546565776c-f2znw 1/1 Running 0 21h kube-system coredns-546565776c-q2kwv 1/1 Running 0 21h kube-system etcd-master 1/1 Running 0 21h kube-system kube-apiserver-master 1/1 Running 0 21h kube-system kube-controller-manager-master 1/1 Running 0 21h kube-system kube-proxy-52fwl 1/1 Running 0 21h kube-system kube-proxy-d95md 1/1 Running 0 4h49m kube-system kube-scheduler-master 1/1 Running 0 21h kube-system metrics-server-86d448cd7f-xmtjx 1/1 Running 0 20h kubesphere-system ks-installer-74b46bd68d-djhk7 1/1 Running 46 3h53m

2、有一个pod 状态是0/1,接下来查看日志:

1、Container image "calico/node:v3.16.4" already present on machine; 2、Calico node 'master' is already using the IPv4 address ? 3、Couldn't autodetect an IPv4 address. If auto-detecting, choose a different autodetection method. Otherwise provide an explicit address. 4、calico/node is not ready: BIRD is not ready: BGP not established with 192.168.0.0

 3、出现以上错误信息中一个的,直接 ip a 查看网卡配置:

(base) [root@master opt]# ip a 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: em1: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether b8:ca:3a:6e:47:90 brd ff:ff:ff:ff:ff:ff inet 192.168.1.215/24 brd 192.168.1.255 scope global noprefixroute em1 valid_lft forever preferred_lft forever inet6 fe80::67e8:9d4a:7715:7fb/64 scope link noprefixroute valid_lft forever preferred_lft forever

em1就是实际网卡(em1下的inet 是我实际登录虚拟机的地址)

4、解决办法:

修改calico.yaml文件:

# Auto-detect the BGP IP address. - name: IP value: "autodetect" - name: IP_AUTODETECTION_METHOD value: "interface=em1" # Enable IPIP - name: CALICO_IPV4POOL_IPIP value: "Always"

在calico.yaml 文件中

#Auto-detect the BGP

加上这个自动侦探方法:

       - name: IP_AUTODETECTION_METHOD               value: "interface=em1"

(注:红色的部分就是我实际的网卡地址,即登录虚拟机的ip所在的那个网卡!)

5、重新部署calico

kubectl apply -f calico.yaml

6、结果如下:

Every 2.0s: kubectl get pod -A Thu Oct 28 15:09:05 2021 NAMESPACE NAME READY STATUS RESTARTS AGE default nfs-client-provisioner-566f7f554d-6hww6 1/1 Running 0 21h kube-system calico-kube-controllers-7567d8d9dd-w8x4z 1/1 Running 3 4h16m kube-system calico-node-kz7gt 1/1 Running 0 38s kube-system calico-node-thqsj 1/1 Running 0 38s kube-system coredns-546565776c-f2znw 1/1 Running 0 21h kube-system coredns-546565776c-q2kwv 1/1 Running 0 21h kube-system etcd-master 1/1 Running 0 21h kube-system kube-apiserver-master 1/1 Running 0 21h kube-system kube-controller-manager-master 1/1 Running 0 21h kube-system kube-proxy-52fwl 1/1 Running 0 21h kube-system kube-proxy-d95md 1/1 Running 0 5h4m kube-system kube-scheduler-master 1/1 Running 0 21h kube-system metrics-server-86d448cd7f-xmtjx 1/1 Running 0 20h kubesphere-system ks-installer-74b46bd68d-djhk7 1/1 Running 46 4h7m

pod 已经 正常!

此!



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3